package com.winchain.chainbill.receivables.biz.impt.cmd;

import com.shell.bee.acct.transaction.po.AcctTxRec;
import com.shell.framework.command.CallbackContext;
import com.shell.framework.command.CommandContext;
import com.shell.framework.command.ICallback;
import com.winchain.chainbill.receivables.base.po.ArRecord;
import org.springframework.stereotype.Component;

@Component
public class ReceivablesQuotaRollbackCmd extends ReceivablesQuotaCmd implements ICallback<ArRecord, AcctTxRec> {
	public boolean callback(CallbackContext<ArRecord, AcctTxRec> context) throws Exception {
		rollback(context);

		return false;
	}

	private boolean rollback(CommandContext<ArRecord> context) throws Exception {
		AcctTxRec tx = getTxRec(context);
		String optType = tx.getOptType();
		if ("qt_snd".equals(optType)) {
			optType = "qt_rec";
		} else if ("qt_rec".equals(optType)) {
			optType = "qt_snd";
		}
		return false;
	}
}
